"use strict";

angular.module('app.auth', ['ui.router', 'ngCookies'])

 .constant('ACCESS_LEVELS', {
        pub: 1,
        detection: 2,
        godownman: 2,
        info: 2,
        branch: 3,
        head: 4,
        admin: 5
    })

 .config(function ($stateProvider, $urlRouterProvider, ACCESS_LEVELS) {

    $stateProvider
      .state('admin', {
         url: '/admin',
         views: {
            root: {
                templateUrl: 'auth/views/login.html',
                 controller: 'LoginCtrl'
            }
         },
         data: {
            title: '登录',
            htmlId: 'extr-page',
            access_level : ACCESS_LEVELS.pub

         },
         resolve: {
            srcipts: function(lazyScript){
                return lazyScript.register([
                    'build/vendor.ui.js'
                ])
            }
        }
      })
      .state('car', {
         url: '/car',
         views: {
            root: {
                 templateUrl: 'auth/views/car.html',
                 controller: 'Carctrl'
            }
         },
         data: {
            title: '车管家',
            htmlId: 'extr-page',
            access_level : ACCESS_LEVELS.pub

         }/*,
         resolve: {
            srcipts: function(lazyScript){
                return lazyScript.register([
                    'build/zui.js',
                    'build/jquery.nicescroll.js',
                    'build/BarCtrl.js'
                ])
            }
        }*/
      })
        .state('car_info', {
            url: '/car_info',
            views: {
                root: {
                    templateUrl: 'auth/views/car_info.html',
                    controller: 'CarInfoCtrl'
                }
            },
            data: {
                title: '车管家',
                htmlId: 'extr-page',
                access_level : ACCESS_LEVELS.pub

            }/*,
            resolve: {
                srcipts: function(lazyScript){
                    return lazyScript.register([
                        'build/vendor.ui.js'
                    ])
                }
            }*/
        })
        .state('wxgzh', {
            url: '/wxgzh',
            views: {
                root: {
                    templateUrl: 'auth/views/wxgzh.html'
                }
            },
            data: {
                title: '登录',
                htmlId: 'extr-page',
                access_level : ACCESS_LEVELS.pub
            }
        })
       .state('error500', {
           url: '/error5',
           views: {
               "content@app": {
                templateUrl: 'granary-info/views/error5.html'

               }
           },
           data: {
               title: 'error',
               access_level: ACCESS_LEVELS.pub
           }
       })

    $urlRouterProvider.otherwise('/admin');

})